import React, {Component} from 'react';
import Search from "./components/Search"
import List from "./components/List";

class App extends Component {

    state = {
        users:[], // 初始化状态user
        isFirst:true,// 标识是否为第一次打开界面
        isLoading:false, // 标识请求之前默认为false
        err:''// 标识存储相关的错误信息
    }

    // 更新App的状态
    updateAppState = (stateObj)=>{
        // stateObj本身就是一个状态对象
        this.setState(stateObj)
    }


    render() {

        return (
            <div className="container">
                <Search updateAppState={this.updateAppState}/>
                <List {...this.state}/>
            </div>
        );
    }
}

export default App;
